home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!hpl3sn03.cern.ch
- From: Dan Pop <danpop@mail.cern.ch>
- Newsgroups: comp.lang.c
- Subject: Re: Unbuffered character input...
- Date: Sat, 3 Feb 1996 22:21:29 +0100
- Organization: CERN European Lab for Particle Physics
- Message-ID: <9602032121.AA00122@dxmint.cern.ch>
- References: <Pine.SGI.3.91.960129190205.27936A-100000@tahiti.cs.unm.edu> <4elf0t$5vd@ixnews2.ix.netcom.com> <4ep3a1$bee@hacgate2.hac.com> <4eu2dt$pm2@elaine18.Stanford.EDU>
- X-NNTP-Posting-Host: hpl3sn03.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
- X-Mail2News-Path: dxmint.cern.ch!hpl3sn03.cern.ch
-
- reckdahl@leland.Stanford.EDU (Keith Reckdahl) writes:
-
- >I understand that it is hard to make I/O code portable, but
- >is it truly *impossible* for C to have a portable unbuffered
- >input function?
-
- Yes.
-
- >Currently C has functions for many other
- >hard-to-port capabilities such as system calls and process
- >spawning.
-
- Nope. C doesn't have any such functions.
-
- >Wouldn't it possible to define an ANSI-standard unbuffered
- >input function and then let the compiler people deal with
- >the individual system details?
-
- No. The compiler people can't fix the problems related to terminals and
- operating systems that don't allow unbuffered terminal I/O.
-
- >This makes more sense than forcing each individual
- >programmer to re-invent the wheel by writing their own
- >portable unbuffered input function.
-
- On systems where unbuffered terminal I/O is possible, the vendors provide
- functions for unbuffered terminal I/O, there is no need for the programmer
- to reinvent anything (all s/he has to do is RTFM).
-
- Having said this, I must add that functions like getch and kbhit could
- actually be added to the standard C library, in the same way as the time()
- function call was added: if the system/implementation cannot meaningfully
- support the function, it returns a special value. Of course, programs
- blindly relying on such functions won't be more portable than they are
- today, even if they would compile and link without any problems.
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-